﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TemplatePage.Master" AutoEventWireup="true"
    CodeBehind="lap-phieu-chi.aspx.cs" Inherits="nhakhoachauau.WebForm2" enableEventValidation="false"%>

<%@ Register Src="~/UC/Menu.ascx" TagName="UCMenu" TagPrefix="UCMENU" %>
<%@ Register Src="~/UC/Title.ascx" TagName="UCTitle" TagPrefix="UCTITLE" %>
<%@ Register Src="~/UC/MenuChucNang.ascx" TagName="UCMenuChucNang" TagPrefix="UCMENUCHUCNANG" %>
<%@ Import Namespace="BUS" %>
<%@ Import Namespace="DTO" %>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
    <title>LẬP PHIẾU TÍNH TIỀN</title>
    <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-fileupload.css" rel="stylesheet" />
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    <link href="css/style-responsive.css" rel="stylesheet" />
    <link href="css/style-default.css" rel="stylesheet" id="style_color" />
    <link rel="stylesheet" type="text/css" href="assets/uniform/css/uniform.default.css" />
    <link rel="stylesheet" href="assets/data-tables/DT_bootstrap.css" />
    <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
    <link href="assets/bootstrap/css/bootstrap-fileupload.css" rel="stylesheet" />
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    <link href="css/style-responsive.css" rel="stylesheet" />
    <link href="css/style-default.css" rel="stylesheet" id="Link1" />
    <link href="assets/fancybox/source/jquery.fancybox.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="assets/uniform/css/uniform.default.css" />
    <link rel="stylesheet" type="text/css" href="assets/chosen-bootstrap/chosen/chosen.css" />
    <link rel="stylesheet" type="text/css" href="assets/jquery-tags-input/jquery.tagsinput.css" />
    <link rel="stylesheet" type="text/css" href="assets/clockface/css/clockface.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-wysihtml5/bootstrap-wysihtml5.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-datepicker/css/datepicker.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-timepicker/compiled/timepicker.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-colorpicker/css/colorpicker.css" />
    <link rel="stylesheet" href="assets/bootstrap-toggle-buttons/static/stylesheets/bootstrap-toggle-buttons.css" />
    <link rel="stylesheet" type="text/css" href="assets/bootstrap-daterangepicker/daterangepicker.css" />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" runat="server">
    <script src="js/jquery-1.8.3.min.js"></script>
    <script src="js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="assets/bootstrap/js/bootstrap.min.js"></script>
    <script src="js/jquery.blockui.js"></script>
    <!-- ie8 fixes -->
    <!--[if lt IE 9]>
   <script src="js/excanvas.js"></script>
   <script src="js/respond.js"></script>
   <![endif]-->
    <script type="text/javascript" src="assets/uniform/jquery.uniform.min.js"></script>
    <script type="text/javascript" src="assets/data-tables/jquery.dataTables.js"></script>
    <script type="text/javascript" src="assets/data-tables/DT_bootstrap.js"></script>
    <script type="text/javascript" src="assets/bootstrap-toggle-buttons/static/js/jquery.toggle.buttons.js"></script>
    <script type="text/javascript" src="assets/chosen-bootstrap/chosen/chosen.jquery.min.js"></script>
    <script type="text/javascript" src="assets/bootstrap-wysihtml5/wysihtml5-0.3.0.js"></script>
    <script type="text/javascript" src="assets/bootstrap-wysihtml5/bootstrap-wysihtml5.js"></script>
    <script type="text/javascript" src="assets/clockface/js/clockface.js"></script>
    <script type="text/javascript" src="assets/jquery-tags-input/jquery.tagsinput.min.js"></script>
    <script type="text/javascript" src="assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-daterangepicker/date.js"></script>
    <script type="text/javascript" src="assets/bootstrap-daterangepicker/daterangepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
    <script type="text/javascript" src="assets/bootstrap-inputmask/bootstrap-inputmask.min.js"></script>
    <script src="assets/fancybox/source/jquery.fancybox.pack.js"></script>
    <!--common script for all pages-->
    <script src="js/common-scripts.js"></script>
    <!--script for this page only-->
    <script src="js/editable-table.js"></script>
    <script src="js/form-component.js"></script>
    <!-- END JAVASCRIPTS -->
    <script>
        jQuery(document).ready(function () {
            EditableTable.init();
        });
function editable-sample_new_onclick() {

}

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <UCMENU:UCMenu runat="server" ID="ucmenu1" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div id="theme-change" class="hidden-phone">
                <i class="icon-cogs"></i><span class="settings"><span class="text">Theme Color:</span>
                    <span class="colors"><span class="color-default" data-style="default"></span><span
                        class="color-green" data-style="green"></span><span class="color-gray" data-style="gray">
                        </span><span class="color-purple" data-style="purple"></span><span class="color-red"
                            data-style="red"></span></span></span>
            </div>
            <h3 class="page-title">
                QUẢN LÝ KHÁM BỆNH
            </h3>
            <ul class="breadcrumb">
                <li><a href="default.aspx">TRANG CHỦ</a> <span class="divider">/</span> </li>
                <li><a href="default.aspx">QUẢN LÝ CHI TIÊU </a></li>
                <li class="pull-right search-wrap">
                    <form action="" class="hidden-phone">
                    <div class="input-append search-input-area">
                        <input class="" id="appendedInputButton" type="text">
                        <button class="btn" type="button">
                            <i class="icon-search"></i>
                        </button>
                    </div>
                    </form>
                </li>
            </ul>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="widget">
                <div class="widget-title">
                    <h4>
                        <i class="icon-th-large"></i>Chức năng
                    </h4>
                    <span class="tools"><a href="javascript:;" class="icon-chevron-up"></a><a href="javascript:;"
                        class="icon-remove"></a></span>
                </div>
                <div class="widget-body" style="display: none;">
                    <!--BEGIN METRO STATES-->
                    <div class="metro-nav">
                        <div class="metro-nav-block nav-block-orange">
                            <a data-original-title="" href="#"><i class="icon-user"></i>
                                <div class="info">
                                    321</div>
                                <div class="status">
                                    Thêm bênh nhân</div>
                            </a>
                        </div>
                        <div class="metro-nav-block nav-block-yellow">
                            <a data-original-title="" href="#"><i class="icon-tags"></i>
                                <div class="info">
                                    +970</div>
                                <div class="status">
                                    Xuất phiếu thu</div>
                            </a>
                        </div>
                        <div class="metro-nav-block nav-block-grey">
                            <a data-original-title="" href="#"><i class="icon-comments-alt"></i>
                                <div class="info">
                                    49</div>
                                <div class="status">
                                    Xuất phiếu chi</div>
                            </a>
                        </div>
                        <div class="metro-nav-block nav-block-blue">
                            <a data-original-title="" href="#"><i class="icon-eye-open"></i>
                                <div class="info">
                                    +897</div>
                                <div class="status">
                                    Tra cứu hồ sơ</div>
                            </a>
                        </div>
                        <div class="metro-nav-block nav-block-red">
                            <a data-original-title="" class="text-center" href="#"><i class="icon-lightbulb"></i>
                                <div class="status">
                                    Trợ giúp</div>
                            </a>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                    <!--END METRO STATES-->
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span5">
            <!-- BEGIN EXAMPLE TABLE widget-->
            <div class="widget purple">
                <div class="widget-title">
                    <h4>
                        <i class="icon-reorder"></i>Thêm phiếu chi tiêu</h4>
                    <span class="tools"><a href="javascript:;" class="icon-chevron-down"></a><a href="javascript:;"
                        class="icon-remove"></a></span>
                </div>
                <div class="widget-body">
                    <div class="cmxform form-horizontal">
                    <div class="control-group">
                        <label class="control-label" style="width: 120px">
                            Nhân viên lập (*)</label>
                        <div class="controls" style="margin-left: 120px;">

                            <%--<select class="span6 chzn-select" style="width: 100%;display:block" data-placeholder="Chọn nhân viên"
                                tabindex="1" id="ddlNhanVienLap" runat=server clientidmode=Static >
                                <% 
                                    Q_BUSNhanVien BUSnv = new Q_BUSNhanVien();
                                    List<NhanVien> dsNhanVien = BUSnv.DanhSachNhanVienLamViec();
                                    foreach(NhanVien nv in dsNhanVien)
                                    {
                                        Response.Write("<option value='"+nv.id+"'>" +nv.ho_ten+ "</option>");
                                    }
                                %>
                                
                            </select>--%>
                            <asp:DropDownList ID="ddlNhanVienLap" runat="server" style="width: 100%" 
                                CssClass="span6 chzn-select" data-placeholder="Chọn nhân viên" tabindex="1" 
                                onload="ddlNhanVienLap_Load">
                            </asp:DropDownList>

                        </div>
                    </div>
                    <div class="control-group ">
                        <label for="cname" class="control-label" style="width: 120px">
                            Số tiền chi (*)</label>
                        <div class="controls" style="margin-left: 120px;">
                            <input type="text" id="txtSoTienChi" runat="server" style="color: Red; font-weight: 900; font-size: large; width: 100%"
                                placeholder="" data-mask="999,990,000 VNĐ" value="000,000,000 VNĐ" class="span5">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" style="width: 120px">
                            Lý do (*)</label>
                        <div class="controls" style="margin-left: 120px;">
                            <textarea id="txtLyDoChi" runat="server" class="span6 " style="width: 100%" rows="3" required></textarea>
                        </div>
                    </div>
                    <div class="form-actions">
                        <%--<button class="btn btn-success" type="submit">
                            Lưu và xuất phiếu chi</button>--%>
                        <asp:Button CssClass="btn btn-success" ID="btnLuuVaXuatPhieuChi" runat="server" 
                            Text="Lưu và xuất phiếu chi" Width="180px" 
                            onclick="btnLuuVaXuatPhieuChi_Click"/>
                       <%-- <button class="btn" type="button">
                            Hủy</button>--%>
                    </div>
                    </div>
                <div class=""> <a name="#error"></a> <span style="font-size: x-large; font-weight: 800; list-style-type: circle; color: Red"> <asp:Label ID="lblError" runat="server" Text=""></asp:Label></span> </div>

                </div>
            </div>
            <!-- END EXAMPLE TABLE widget-->

        </div>
        <div class="span7">
            <!-- BEGIN EXAMPLE TABLE widget-->
            <div class="widget purple">
                <div class="widget-title">
                    <h4>
                        <i class="icon-reorder"></i>Danh sách chi tiêu trong ngày - <%
                                        Response.Write(DateTime.Now.ToShortDateString());
                                    %></h4>
                    <span class="tools"><a href="javascript:;" class="icon-chevron-down"></a><a href="javascript:;"
                        class="icon-remove"></a></span>
                </div>
                <div class="widget-body">
                    <div>
                        <div class="clearfix">
                            <div class="btn-group">
                                <%--<button id="editable-sample_new" class="btn green" onclick="return editable-sample_new_onclick()">
                                    Lập phiếu chi <i class="icon-plus"></i>
                                </button>--%>
                            </div>
                            <div class="btn-group pull-right">
                                <button class="btn dropdown-toggle" data-toggle="dropdown">
                                    Tools <i class="icon-angle-down"></i>
                                </button>
                                <ul class="dropdown-menu pull-right">
                                    <li><a href="#">Print</a></li>
                                    <li><a href="#">Save as PDF</a></li>
                                    <li><a href="#">Export to Excel</a></li>
                                </ul>
                            </div>
                        </div>
                        <div class="space15">
                        </div>
                        <table class="table table-striped table-hover table-bordered" id="editable-sample">
                            <thead>
                                <tr>
                                    <th>
                                        Stt
                                    </th>
                                    <th>
                                        Số tiền
                                    </th>
                                    <td>
                                        Nhân viên lập
                                    </td>
                                    <th>
                                        Lý do
                                    </th>
                                    <th>
                                        Xoá</th>
                                </tr>
                            </thead>
                            <tbody>
                            <% 
                                Q_BUSChi BUSChi = new Q_BUSChi();
                                Q_BUSNhanVien BUSnv = null ;
                                List<Chi> dsChi = BUSChi.DanhSachChiTheoNgay(DateTime.Now);
                                int i = 1;
                                decimal TongTienChi = 0;
                                foreach (Chi chi in dsChi)
                                {
                                    TongTienChi += (decimal)chi.so_tien_chi;
                                    %>
                                    <tr class="">
                                    <td>
                                        <% Response.Write(i); %>
                                    </td>
                                    <td>
                                        <% Response.Write(string.Format("{0:#,###} VNĐ", chi.so_tien_chi)); %>
                                    </td>
                                    <td>
                                        <% 
                                            BUSnv = new Q_BUSNhanVien();
                                            Response.Write(BUSnv.ThongTinNhanVienTheoID(chi.id_nhanvien).ho_ten); 
                                        %>
                                    </td>
                                    <td class="center">
                                        <% Response.Write(chi.ly_do_chi); %>
                                    </td>
                                    <td>
                                        <% Response.Write("<a href=\"lap-phieu-chi.aspx?del=on&id="+ chi.id +"\">Xoá</a>"); %>
                                    </td>
                                </tr>
                                <%
                                    i++;
                                }
                            %>
                            </tbody>
                        </table>
                        <div class="form-actions">
                            <div class="cmxform form-horizontal">
                            <div class="control-group ">
                                <label for="cname" class="control-label" style="width: 200px">
                                    Tổng chi tiêu trong ngày
                                    <br />
                                    <%
                                        Response.Write(DateTime.Now.ToShortDateString());
                                    %></label>
                                <div class="controls" style="margin-left: 200px;">
                                
                                    <input class="span6 " value="<% Response.Write(string.Format("{0:#,##0}", TongTienChi));%> VNĐ" id="Text2" name="name" style="color: Red;
                                        font-weight: 900; font-size: large; width: 100%" minlength="2" type="text" disabled />
                                    <span class="help-inline"><span></span></span>
                                </div>
                            </div>
                            <div class="form-actions">
                                <button class="btn btn-success" type="submit">
                                    In danh sách chi tiêu</button>
                            </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- END EXAMPLE TABLE widget-->
        </div>
         
    </div>
</asp:Content>
